﻿

float RemapW(float edge0, float edge1, float x) {
    return saturate((x - edge0) / (edge1 - edge0));
 
}

void Weather( 

inout 
#ifdef BASE_DATA
	SurfaceData
#else
 LchSurfaceData

#endif

 

surfaceData,inout InputData inputData,float3 vsNormalWS ,float3 positionWS)
{
	
	if(weaterParams.x)
	{	
		
		if(weaterParams.x==1.0)
		{
			//float3 bump = UnpackNormalS(SAMPLE_TEXTURE2D(_BumpNoise16X16, sampler_BumpNoise16X16, positionWS.xz*weaterParams3.y) ).xzy;
			float y = inputData.normalWS.y ;
			float t = saturate((y-weaterParams.y) / weaterParams.z)*weaterParams2.a;  
			 
			surfaceData.albedo = lerp(surfaceData.albedo,weaterParams2.rgb, t);
			surfaceData.smoothness  =lerp(surfaceData.smoothness, weaterParams.w ,t);
			surfaceData.metallic = lerp(surfaceData.metallic,0.0   ,t); 
 
			inputData.normalWS = lerp(inputData.normalWS , vsNormalWS  , t); 
			
 
		 
		}
		
	}
	


}